import { createApp } from 'vue';
import { components, plugins, options } from '@/plugins/element.js';
import 'element-plus/lib/theme-chalk/index.css';
import router from '@/router';
import BasicForm from '@/components/basicForm/index.vue';
import BasicTable from '@/components/basicTable/index.vue';
import App from '@/App.vue';
import '@/assets/css/public.less';
import '@/common.less';

const app = createApp(App);

app.use(router);
components.forEach((component) => {
  if (component.name === 'ElLink') {
    component.props.type.default = 'primary';
    component.props.underline.default = false;
  }
  app.use(component);
});
plugins.forEach((plugin) => {
  app.use(plugin);
});
app.component('BasicForm', BasicForm);
app.component('BasicTable', BasicTable);
app.config.globalProperties.$ELEMENT = options;

app.mount('#app');

if (import.meta.env.DEV) {
  window.$APP$ = app;
}
